package com.runoob.generics;

public class MaximumTest {

    public static <T extends Comparable<T>> T maximum(T x,T y,T z){

        T max=x;//假设x是初始最大值
        if (y.compareTo(max)>0){
             max=y;//y更大
        }
        if (z.compareTo(max)>0){
             max=z;//y更大
        }
        return max;
    }


    public static void main(String[] args) {
        System.out.println(maximum(3,4,5));
        System.out.println(maximum(6.6,8.8,7.7));
        System.out.println(maximum("pear","apple","orange"));
    }
}
